<template>
  <div class="correlation">
    <img v-if="correlation.images.length >0" :src="correlation.images[0]" alt />
    <img v-else src="../../assets/img/pic_sea.jpeg" alt />
    <div class="correlation_content">
      <div class="correlation_content_title">{{correlation.title}}</div>
      <div class="correlation_info">
        <!-- 2019-05-22 1:16 阅读 705 -->
        <span>{{timeYears}}</span>
        <span>{{timeMinute }}</span>
      </div>
    </div>
  </div>
</template>

<script>
// 导入时间处理库
// http://momentjs.cn/docs/#/parsing/
import moment from "moment";
export default {
  props: ["correlation"],
  computed: {
    timeYears() {
      const years = moment(this.correlation.created_at).format("YYYY-MM-DD");
      return years;
    },
    timeMinute() {
      const minute = moment(this.correlation.created_at).format("HH:mm");
      return minute;
    }
  }
};
</script>

<style lang="less" scoped>
.correlation {
  display: flex;
  justify-content: space-between;
  height: 80px;
  padding: 20px 0;
  border-top: 1px solid #ddd;
  //   border-bottom:1px solid #ddd;
  img {
    width: 100px;
    height: auto;
  }
  .correlation_content {
    width: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .correlation_content_title {
      height: 40px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    .correlation_info {
      color: #999;
      font-size: 12px;
    }
  }
}
</style>